package com.wl.msm.controller;

import com.wl.connonutils.R;
import com.wl.msm.service.MsmService;
import com.wl.msm.utils.RLYMsm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author lei.wan
 * @since 2021/9/2
 */
@RestController
@RequestMapping("/edumsm/msm")
public class MsmController {

    @Autowired
    private MsmService msmService;

    @GetMapping("send/{phone}")
    public R sendMsm(@PathVariable("phone")String phone){
        Map<String, Object> map = msmService.sendMsm(phone);
        Boolean status = (Boolean) map.get("status");
        if(!status){
            return R.error().message(map.get("error").toString());
        }
        return R.ok();
    }
}
